package com.hxx.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hxx.entity.DailyTrainStationEntity;
import com.hxx.service.DailyTrainStationService;
import com.hxx.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/dailyTrainStation")
public class DailyTrainStationController {
    @Autowired
    private DailyTrainStationService dailyTrainStationService;


    @GetMapping("page")
    public R listPage(Page page, DailyTrainStationEntity dailyTrainStation) {
        dailyTrainStationService.listPage(page, dailyTrainStation);
        return R.ok().data("list",page.getRecords())
                .data("total",page.getTotal());
    }

    @PostMapping("save")
    public R save(@RequestBody DailyTrainStationEntity dailyTrainStation) {
        dailyTrainStationService.save(dailyTrainStation);
        return R.ok();
    }

    @PutMapping("update")
    public R update(@RequestBody DailyTrainStationEntity dailyTrainStation) {
        dailyTrainStationService.updateById(dailyTrainStation);
        return R.ok();
    }

    @DeleteMapping("delete/{id}")
    public R delete(@PathVariable Long id) {
        dailyTrainStationService.removeById(id);
        return R.ok();
    }
}




















